package com.sk.bilibili.controller;

import com.sk.bilibili.other.R;
import com.sk.bilibili.service.SmsCodeService;
import com.sk.bilibili.service.SmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author 邵康
 * @date 2021/11/22 16:38
 */
@CrossOrigin
@RestController
@Api(tags = "短信相关")
@RequestMapping("/smsCode")
public class SmsCodeController {

    @Autowired
    private SmsCodeService smsCodeService;

    @ApiOperation("发送短信验证码")
    @GetMapping("/sendMsg")
    public R<Void> sendMsg(String phone){
        return smsCodeService.sendMsg(phone);
    }

    @ApiOperation("验证短信验证码")
    @GetMapping("/checkCode")
    public R<Void> checkCode(String phone,String code){
        return smsCodeService.checkCode(phone,code);
    }

}
